package com.jiuzhe.commercial.main;

/**
 * Created by huanghao on 2018/5/25.
 */

import android.content.Intent;
import android.text.TextUtils;
import android.view.View;

import com.jiuzhe.commercial.R;
import com.jiuzhe.commercial.base.BaseActivity;
import com.jiuzhe.commercial.bean.RegisterBean;
import com.jiuzhe.commercial.utils.UIUtils;
import com.jungly.gridpasswordview.GridPasswordView;

import java.io.Serializable;

import butterknife.BindView;
import butterknife.OnClick;


public class SettingPayPassWordActivity extends BaseActivity {
    @BindView(R.id.pswView)
    GridPasswordView pswView;
    private String mEndPsw;

    @Override
    protected void loadViewLayout() {
        setContentView(R.layout.activity_setting_password);
        setTitle("设置提现支付密码");
    }

    @Override
    protected void loadData() {
        pswView.setOnPasswordChangedListener(new GridPasswordView.OnPasswordChangedListener() {
            @Override
            public void onTextChanged(String psw) {

            }

            @Override
            public void onInputFinish(String psw) {
                mEndPsw = psw;
            }
        });
    }



    @OnClick({R.id.bt_next})
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.bt_next:
             String  psw  = pswView.getPassWord();
                if (TextUtils.isEmpty(psw)){
                    UIUtils.showToastSafe("请设置你的支付密码");
                    return;
                }

                RegisterBean registerBean = (RegisterBean) getIntent().getSerializableExtra("register");
                Intent intent = new Intent(SettingPayPassWordActivity.this, SettingTwoPassWordActivity.class);
                intent.putExtra("register", (Serializable) registerBean);
                intent.putExtra("psw", mEndPsw);
                startActivity(intent);
                break;
        }
    }
}
